#!/usr/bin/env ts-node
import { PrismaClient, Prisma } from "@prisma/client";
import { faker } from "@faker-js/faker";
console.log("gender:", faker.name.gender());

const prisma = new PrismaClient();
const getUser = () => {
  const localTelephone = faker.phone.phoneNumber("188########");
  return {
    password: faker.internet.password(6),
    telephone: localTelephone,
  };
};

const getProfile = (userId:number, telephone:string) => {

  const localGender = () => {
    switch (faker.name.gender(true)) {
      case "Female":
        return "女";
      case "Male":
        return "男";
    }
  };

  const localName = () => {
    faker.locale = "zh_CN";
    return faker.name.lastName() + faker.name.lastName();
  };

  const englishEmail = () => {
    faker.locale = "en";
    return faker.internet.email();
  };
  // return {
  //   name: localName(),
  //   telephone: "",
  //   gender: "",
  //   allowedPages: [],
  //   email: englishEmail(),
  //   userId: "",
  // };
};
async function main() {
  const users = new Array();
  for (let index = 0; index < 100; index++) {
    users.push(getUser());
    // console.log(getFakerUser());
  }
  const createUser = await prisma.user.createMany({ data: users });
}

main()
  .catch((e) => {
    throw e;
  })
  .finally(async () => {
    await prisma.$disconnect();
  });
